package com.zhu.salesmanagement.network;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.xmlrpc.android.XMLRPCClient;

import com.zhu.salesmanagement.common.Actions;

import android.util.Log;

public class PostMethod {

	public static final String CALL_LOGIN = "dmsmobile.getSalesperson";
	public static final String CALL_PRODUCTCATEGORY = "dmsmobile.getProductCategory";
	public static final String CALL_PRODUCT= "dmsmobile.getProduct";
	public static final String CALL_REMIND = "dmsmobile.getRemindMSG";
	public static final String CALL_CUSTOMER= "dmsmobile.getCustomer";
	public static final String CALL_CUSTOMERSHELF= "dmsmobile.getProductCategoryAndCustomerShelfOfCustomers";
	public static final String CALL_UPDATECUSTOMERSHELF= "dmsmobile.getProductCategoryOfCustomers";
	public static final String CALL_TASKLIST = "dmsmobile.getDatingTaskList";
	public static final String POST_ADDEDNEWSTORES = "dmsmobile.putCustomerTempSC";
	public static final String POST_CUSTOMERSHELF= "dmsmobile.putCustomerShelf";
	public static final String POST_VISITEDTASK = "dmsmobile.putDatingTaskActual";
	public static final String POST_VISITEDTASKCRC = "dmsmobile.putDatingTaskActualCRC";
	public static final String POST_VISITEDTASKOTHER = "dmsmobile.putDatingTaskActualOther";
	public static final String POST_CUSTOMERCLOSE= "dmsmobile.putCustomerClosed";
	public static final String POST_STOREPROPERTY= "dmsmobile.putStorePropertyInquire";
	public static final String POST_COMPLETETED= "dmsmobile.isCompleted";
	public static final String CALL_NETWORKTIME= "dmsmobile.getNetworkTime";
	public static final String POST_DTASKACTUALPHOTO = "dmsmobile.putDatingTaskActualPhotoSC";

	/**
	 * 请求登录
	 * dmsmobile.getSalesperson
	 */
	public static void requesLogin(String name, String password, boolean isFirst, String version, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_LOGIN, callback, client);
    	if(Actions.DEBUG){
    		Log.e("zhu","isFirst="+isFirst);
    	}
    	Object[] params = { name, password, isFirst ? 1 : 0, version};
        method.call(params);
	}

	/**
     * 请求客户数据
     * dmsmobile.getCustomer
     */
	public static void requesCustomer(String eid, String uuid, boolean isFirst, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_CUSTOMER, callback, client);
        Object[] params = new Object[]{ eid, uuid};
        method.call(params);
    }

	/**
	 * 请求产品大类
	 * dmsmobile.getProductCategory
	 */
	public static void requesProductCategory(String eid, String uuid, boolean isFirst, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_PRODUCTCATEGORY, callback, client);
    	Object[] params = { eid, uuid };
        method.call(params);
	}

	/**
     * 请求产品信息
     * dmsmobile.getProduct
     */
	public static void requesProducts(String eid, String uuid, boolean isFirst, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_PRODUCT, callback, client);
    	Object[] params = { eid, uuid };
        method.call(params);
	}

	/**
	 * 请求产品大类货架信息
	 * dmsmobile.getProductCategoryAndCustomerShelfOfCustomers
	 */
	public static void requesCustomerShelfs(String eid, String uuid, boolean isFirst, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_CUSTOMERSHELF, callback, client);
        Object[] params = { eid, uuid };
        method.call(params);
    }

	/**
     * 更新产品大类数据
     * dmsmobile.getProductCategoryOfCustomers
     */
	public static void requesUpdateCustomerPC(String eid, String uuid, boolean isFirst, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_UPDATECUSTOMERSHELF, callback, client);
        Object[] params = { eid, uuid };
        method.call(params);
    }

	/**
     * 请求拜访任务
     * dmsmobile.getDatingTaskList
     */
	public static void requesMyTaskList(String eid, String uuid, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_TASKLIST, callback, client);
        Object[] params = { eid, uuid };
        method.call(params);
    }


	/**
     * 请求提醒数据
     * dmsmobile.getRemindMSG
     */
	public static void requesRemindMsg(String eid, String uuid, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_REMIND, callback, client);
    	Object[] params = { eid, uuid };
        method.call(params);
	}

	public static void postNewStores(String eid, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_REMIND, callback, client);
    	 Map<String, Object> map = new HashMap<String, Object>();
         map.put("sEmployeeID", eid);
    	Object[] params = { map };
        method.call(params);
	}

	/**
     * 上传货架信息
     * dmsmobile.putCustomerShelf
     */
	public static void postCustomerShelf(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_CUSTOMERSHELF, callback, client);
        method.call(params);
	}

	/**
     * 上传拜访任务信息
     * dmsmobile.putDatingTaskActual
     */
	public static void postDatingTaskActual(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_VISITEDTASK, callback, client);
        method.call(params);
	}

	/**
     * 上传CRC信息
     * dmsmobile.putDatingTaskActualCRC
     */
	public static void postDatingTaskActualCRC(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_VISITEDTASKCRC, callback, client);
        method.call(params);
	}
	
	/**
	 * 上传其他重要和竟品数据
	 * dmsmobile.putDatingTaskActualOther
	 */
	public static void postDatingTaskActualOther(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_VISITEDTASKOTHER, callback, client);
        method.call(params);
	}

	/**
	 * 上传新增们点数据
	 * dmsmobile.putCustomerTemp
	 */
	public static void postNewAddedStores(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_ADDEDNEWSTORES, callback, client);
        method.call(params);
	}

	/**
     * 上传歇业们点数据
     * dmsmobile.putCustomerClosed
     */
	public static void postCustomerClose(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_CUSTOMERCLOSE, callback, client);
        method.call(params);
	}

	/**
     * 上传们点属性数据
     * dmsmobile.putStorePropertyInquire
     */
	public static void postStoreProperty(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_STOREPROPERTY, callback, client);
        method.call(params);
    }

	/**
     * 同步完成请求
     * dmsmobile.isCompleted
     */
	public static void postCompeleted(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_COMPLETETED, callback, client);
        method.call(params);
	}

	/**
     * 请求网络时间
     * dmsmobile.getNetworkTime
     */
	public static void requestNetworkTime(String eid, String uuid, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_NETWORKTIME, callback, client);
        Object[] params = { eid, uuid };
        method.call(params);
    }

	public static void putDatingTaskActualPhoto(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_DTASKACTUALPHOTO, callback, client);
        method.call(params);
    }
}
